package org.example.netty.test.nio.netty.chat.bean;

import lombok.ToString;
import org.example.netty.test.nio.netty.chat.common.MessageType;
import org.example.netty.test.nio.netty.chat.common.SystemId;

/**
 * @author zp
 * @version 1.0
 * @description: 登入的消息体
 * @date 2023/3/30 19:54
 */
@ToString
public class LoginMessage extends AbsMessageBase {
    private String userName;
    private String password;

    /**
     * @description: 构建登入消息
     * @author zp
     * @date: 2023/4/8 19:13
     * @param userName
     * @param password
     * @return LoginMessage
     */
    public static LoginMessage buildLogin(String userName, String password) {
        LoginMessage loginMessage = new LoginMessage();
        loginMessage.setUserName(userName);
        loginMessage.setPassword(password);
        loginMessage.setContent("注册用户");
        loginMessage.setSender(SystemId.SERVER_ID);
        loginMessage.setRecipient("99");
        return loginMessage;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public LoginMessage(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }

    public LoginMessage() {
    }

    @Override
    public int getMessageType() {
        return MessageType.MESSAGE_TYPE_LOGIN;
    }
}
